# 第一个阶段基于python做构建
FROM python:3.7.7 as builder

COPY ./requirements.txt ./requirements.txt

RUN pip install -i  https://mirrors.aliyun.com/pypi/simple -r requirements.txt && find /usr/local/lib -name '*.pyc' -delete

# 第二个阶段基于slim做构建
FROM python:3.7.7-slim

# 拷贝编译好的库
COPY --from=builder /usr/local/lib/python3.7/site-packages /usr/local/lib/python3.7/site-packages

RUN mkdir /apps

COPY ./ /apps
#COPY model.bin /apps

WORKDIR /apps

ENV PROFILES=pro

RUN chmod 777 run.sh

CMD ./run.sh